package com.example.demo;

import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

@Component
@PropertySource(value = "classpath:datatype.properties")
@ConfigurationProperties(prefix = "datatype")
@Data
public class TestBean {

//    @Value("${spring.application.name}")
//    private Map<String,String> properties;

//    @Value("#{${datatype.scope}}")
    public static Map<String,String> scope;

    @PostConstruct
    public void init(){
        System.out.println("properties = " + scope);
    }

    public void setScope(Map<String, String> scope) {
        TestBean.scope = scope;
    }
}
